Skip to content

feat(cli)!: standardize ATT&CK export command#237

Merged
jondricek merged 7 commits intomainfrom
add-attack-changelog-command
May 7, 2026
Merged

feat(cli)!: standardize ATT&CK export command#237
jondricek merged 7 commits intomainfrom
add-attack-changelog-command

Conversation

@jondricek
Copy link
Copy Markdown
Contributor

@jondricek jondricek commented May 6, 2026

This pull request introduces significant improvements to the CLI interface for exporting ATT&CK data to Excel, refactors documentation and configuration to use consistent command names, and adds support for more efficient local testing. The main highlights are the migration from an argparse-based CLI to a typer-powered CLI for attack-to-excel, improved documentation and usage examples, and the addition of a fast test subset for development.

CLI and API changes:

  • Migrated attackToExcel_cli to a new attack-to-excel CLI using typer, with subcommands from-stix and from-release for converting STIX bundles and full releases to Excel, respectively. The CLI now supports more flexible options, improved validation, and better error messages. ([[1]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-8f2d932337938ce9636015b3325fe81857f7f675dfccda2eb7665ecd20914154L1-R213), [[2]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-8f2d932337938ce9636015b3325fe81857f7f675dfccda2eb7665ecd20914154L412-R737))
  • Added the export_release API and CLI support, allowing batch export of all or selected domains from a release, with automatic downloading of missing STIX bundles and improved directory management. ([mitreattack/attackToExcel/attackToExcel.pyL1-R213](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-8f2d932337938ce9636015b3325fe81857f7f675dfccda2eb7665ecd20914154L1-R213))

Documentation updates:

  • Updated CLI and Python usage examples in README.md to reflect the new attack-to-excel command and its subcommands, including instructions for exporting from releases and handling missing STIX files. ([[1]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-5d824234059da3003f2d5b57c40ff91cb7bb382834f1781c78c6fb4bb5c28269L13-R46), [[2]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-5d824234059da3003f2d5b57c40ff91cb7bb382834f1781c78c6fb4bb5c28269R59-R66), [[3]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-5d824234059da3003f2d5b57c40ff91cb7bb382834f1781c78c6fb4bb5c28269R80))
  • Updated references and docstrings to use the new CLI names (attack-to-excel, attack-changelog) for consistency across documentation and code. ([[1]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-3f49d028fe4785c8d1221c0022575a1fdb05a055c01c00debe456357f0f949ceL59-R69), [[2]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-eeffd82f346c3a6879b2e2c566bddbcb232daf36cf450bd3fa7659206ba3dc17L162-R162), [[3]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-eeffd82f346c3a6879b2e2c566bddbcb232daf36cf450bd3fa7659206ba3dc17L362-R362), [[4]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-2170661eed8204cb5513e828165e4ffe6f9558f36e978021ec2e65f4d808f83aL1-R1))

Testing and developer workflow improvements:

  • Added a just test-fast command and corresponding pytest marker configuration to support running a fast subset of tests locally, excluding integration and slow tests, and updated contributing guidelines accordingly. ([[1]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-deb9bb56fb122db0b605aa5b63f95a4665c905b18dd670e1fa6c877576a94ff1R38-R41), [[2]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-4c6b93aa75d5affde60dc3849606c9acd75ed444d52e99f3055fc0c7aa77e9e0L54-R61), [[3]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L83-R89))
  • Enhanced test output in CI by adding the --durations=20 flag to pytest, helping identify slowest tests. ([.github/workflows/lint-and-test.ymlL50-R50](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-9a979a1e38ba79e2c75e54c4bf21fe1a2a1b935e1736666565f992e634dadd0fL50-R50))

Configuration and packaging:

  • Updated pyproject.toml to register new CLI entry points (attack-to-excel, attack-changelog), update dependencies, and configure pytest markers. ([[1]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L44-R58), [[2]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L83-R89))

Minor fixes:

  • Improved typing and fixed minor inconsistencies in helper modules. ([[1]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-6ae1ed734de765c55aa359c793efe4b367a23180829b5f6e9e98909a9ac5be0eL13-R13), [[2]](https://github.com/mitre-attack/mitreattack-python/pull/237/files#diff-6ae1ed734de765c55aa359c793efe4b367a23180829b5f6e9e98909a9ac5be0eL1432-R1432))

These changes modernize the CLI experience, improve developer productivity, and ensure consistency across documentation, code, and continuous integration.

jondricek added 7 commits May 6, 2026 09:16
- Added slow marker to several tests in `test_cli.py` and `test_layers.py` to categorize them for longer execution times.
- Refactored `test_export_excel` in `test_cli.py` to utilize a mock `ToExcel` class for testing Excel export argument wiring.
- Improved `test_export_with_memstore_uses_current_dataframe_builder` and `test_export_with_pre_v18_version_uses_legacy_dataframe_builder` in `test_to_excel.py` to validate dataframe building logic based on version.
- Introduced new tests in `test_to_excel.py` to verify the creation of expected workbooks, handling of empty data, deduplication of citations, and sanitization of matrix sheet names.
- Updated `uv.lock` to require pytest version 9.0 or higher for development dependencies.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

@jondricek jondricek changed the title feat: add attack changelog command feat!: add attack changelog command May 7, 2026
@jondricek jondricek changed the title feat!: add attack changelog command feat(cli)!: standardize ATT&CK export command names May 7, 2026
@jondricek jondricek changed the title feat(cli)!: standardize ATT&CK export command names feat(cli)!: standardize ATT&CK export command May 7, 2026
@jondricek jondricek merged commit e946f22 into main May 7, 2026
8 checks passed
@jondricek jondricek deleted the add-attack-changelog-command branch May 7, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant